﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenTK;
using OpenTK.Input;

namespace GLPong
{
    class InputManager
    {
        private static InputManager _instance = null;

        public static InputManager Instance
        {
            get
            {
                if (_instance == null)
                    _instance = new InputManager();

                return _instance;
            }
        }

        Palette _p1;
        Palette _p2;

        private InputManager()
        {
        }

        public void Init(Palette p1, Palette p2)
        {
            _p1 = p1;
            _p2 = p2;
        }

        public void ProcessKeyboardInput(KeyboardKeyEventArgs e)
        {
            switch (e.Key)
            {
                case Key.Up:
                    _p1.UpdatePosTmp(5);
                    break;
                case Key.Down:
                    _p1.UpdatePosTmp(-5);
                    break;
                case Key.Z:
                    _p2.UpdatePosTmp(5);
                    break;
                case Key.S:
                    _p2.UpdatePosTmp(-5);
                    break;
            }
        }
    }
}
